﻿using System.Collections;

namespace Magic.System;


#region 输出
public class SysRoleDetailOutput
{
    public int Id { get; set; }
    public int Pid { get; set; }
    public string Name { get; set; }

    public long Createtime { get; set; }
    public long Updatetime { get; set; }
    public List<int> Permissions { get; set; }
    public StatusEnum Status { get; set; }
}

public class SysRoleTreeOutput : ITreeNode
{
    public long GetId()
    {
        return Id;
    }

    public long GetPid()
    {
        return Pid;
    }

    public void SetChildren(IList children)
    {
        Children = (List<SysRoleTreeOutput>)children;
    }
    /// <summary>
    /// 子节点
    /// </summary>
    public List<SysRoleTreeOutput> Children { get; set; } = new List<SysRoleTreeOutput>();

    /// <summary>
    /// ID 
    ///</summary>
    public int Id { get; set; }
    /// <summary>
    /// 上级分组 
    /// 默认值: 0
    ///</summary>
    public int Pid { get; set; }
    /// <summary>
    /// 组名 
    /// 默认值: 
    ///</summary>
    public string Name { get; set; }
    /// <summary>
    /// 权限规则ID 
    ///</summary>
    public string Permissions { get; set; }
    /// <summary>
    /// 创建时间 
    ///</summary>
    public int? Createtime { get; set; }
    /// <summary>
    /// 更新时间 
    ///</summary>
    public int? Updatetime { get; set; }
    /// <summary>
    /// 状态:0=禁用,1=启用 
    /// 默认值: 1
    ///</summary>
    public string Status { get; set; }
}
#endregion

#region 输入

/// <summary>
/// 新增AdminGroup输入
/// </summary>
public class AddSysRoleInput
{
    /// <summary>
    /// 上级分组 
    /// 默认值: 0
    ///</summary>
    [Required(ErrorMessage = "上级分组不能为空")]
    public int Pid { get; set; }
    /// <summary>
    /// 组名 
    /// 默认值: 
    ///</summary>
    [Required(ErrorMessage = "上级分组不能为空")]
    [StringLength(maximumLength: 20, ErrorMessage = "组名不能超过10个字", MinimumLength = 2)]
    public string Name { get; set; }
    /// <summary>
    /// 权限规则ID 
    ///</summary>
    [Required(ErrorMessage = "权限规则ID不能为空")]
    public int[] Permissions { get; set; }
    /// <summary>
    /// 创建时间 
    ///</summary>
    public long? Createtime { get; set; } = new DateTimeOffset(DateTime.Now).ToUnixTimeMilliseconds();
    /// <summary>
    /// 更新时间 
    ///</summary>
    public long? Updatetime { get; set; } = new DateTimeOffset(DateTime.Now).ToUnixTimeMilliseconds();
    /// <summary>
    /// 状态:0=禁用,1=启用 
    /// 默认值: 1
    ///</summary>
    public string Status { get; set; }
}
/// <summary>
/// 编辑AdminGroup输入
/// </summary>
public class EditSysRoleInput : AddSysRoleInput
{
    [Required(ErrorMessage = "id不能为空")]
    public int id { get; set; }
}
/// <summary>
/// 分页输入
/// </summary>
public class SysRolePageInput : BaseSearchInput
{

}

#endregion